<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <title>聊天</title>
</head>
<body>
    <div id="dome" style="width:100%;height:50px;text-align: center;border: 1px red solid">在线聊天</div>
<script src="__STATIC__/index/js/jquery-1.8.3.js"></script>
<!--[if lt IE 9]>
<script src="https://g.alicdn.com/aliww/ww/json/json.js" charset="utf-8"></script>
<![endif]-->
<!-- 自动适配移动端与pc端 -->
<script src="https://g.alicdn.com/aliww/??h5.openim.sdk/0.1.4/scripts/wsdk.js,h5.openim.kit/0.0.5/scripts/kit.js" charset="utf-8"></script>

<script>

        WKIT.init({
            container: document.getElementById('dome'),
            uid: '{$uid}' || 'test0',
            appkey: '{$appkey}' || '23018936',
            credential: '{$pwd}' || '123456',
            touid: '{$touid}' || 'test1',
            onMsgReceived: function(data){
                console.log(data);
            },
            onMsgSent: function(data){
                $.ajax({
                    type : "POST",
                    url: "{:url('chat/setChatCache')}",
                    data: {data:'{$token}'},
                    dataType: "json",
                    success: function(res){
                        console.log(res);
                    }
                });
            },
            autoMsg: '',
            titleBar: true,
            title: '在线聊天',
            onBack: function(){
              console.log('back');
            },
            onUploaderError: function(error){
                console.log(error);
            }
        });

</script>
</body>
</html>